home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 026a / laserpro.zip / README.TXT < prev    next >
Text File  |  1991-05-26  |  6KB  |  156 lines

  1. THE FOLLOWING IS AN ARTICLE WRITTEN BY RICHARD ELLIOTT IN THE
  2. JANUARY ISSUE OF THE "PINTER FOXPRO NEWSLETTER" PUBLISHED BY:
  3.  
  4.         PINTER CONSULTING
  5.         P.O. BOX 1324
  6.         MENLO PARK, CA 94026-1324
  7.         (415) 325-7953
  8.  
  9. -----------------------------------------------------------------
  10.  
  11.      I bought Les Pinter's book, Foxpro Programming just to get my
  12. hands on the Laserjet library.  It was worth it for those routines
  13. alone.  
  14.  
  15.      Since then I have updated the library (added a few routines of
  16. my own and revised others) to take better advantage of the Foxpro
  17. environment.  The original library could work in either Foxbase or
  18. Foxpro, but my revised version in Foxpro only.  Basically what I
  19. did was to convert all of the procedures to variables or functions,
  20. and the way I got away with it was to use the ??? output command. 
  21.  
  22.      What makes this command useful is that it implicetly uses the
  23. SET PRINTER ON and SET PRINTER OFF so you don't have to.  The old
  24. way would be to do something like this:
  25.  
  26.  
  27.      PROCEDURE 
  28.           SET PRINTER ON
  29.           ?? printer_command
  30.           SET PRINTER OFF
  31.      RETURN
  32.  
  33. By using the ??? command all you have to do is:
  34.  
  35.      ??? printer_command
  36.  
  37.      You can create any number of printer commands as variables,
  38. including long strings.  The only time this will not work is where
  39. you need to pass a parameter (such as lines per inch, etc.).  In
  40. this case a function works better than procedure.  Why?  Because it
  41. can be called with ???.  For example, with the previous library you
  42. would use:
  43.  
  44. DO shading WITH 2,4,3,5,10
  45.  
  46. While using a function you could say:
  47.  
  48. ??? SHADING(2,4,3,5,10)
  49.  
  50.      What's the advantage?  For one the function is slightly
  51. smaller and slightly faster.  (see full listing).  But the real
  52. advantage comes in the versatility of functions.  You even can
  53. capture the output to a variable.  For example:
  54.  
  55. DO shading WITH 2,4,3,5,10
  56. DO box WITH 2,4,3,5,10
  57.  
  58. Is the same as:
  59.  
  60. ??? SHADING(2,4,3,5,10) 
  61. ??? BOX(2,4,3,5,10)
  62.  
  63. Or:
  64.  
  65. ??? SHADING(2,4,3,5,10) + BOX(2,4,3,5,10)
  66.  
  67. Or:
  68.  
  69. shade_box = SHADING(2,4,3,5,10) + BOX(2,4,3,5,10)
  70. ??? shade_box
  71.  
  72.      Notice how multiple functions can also be called on the same
  73. line.  By capturing the output of the function to a variable you
  74. can now output it over and over again without calling the
  75. functions.  On simple reports this would not save much time, but
  76. for complex multi-page and multi-copy forms it can really be a time
  77. saver.  You could even capture a whole form to a memo field and
  78. fill it out with the SAYIT(), SOFTFONT() and INTERNAL() functions
  79. being the only ones called in the code.  Preset a whole forms
  80. library in memo fields and you've got it made!
  81.  
  82.      One other major change I made was to declare most of the
  83. internal font management printer escape sequences as variables. 
  84. This provides more versatility in my opinion than the DO INTERNAL
  85. WITH or the INTERNAL() function.  For example I could set a
  86. compressed landscape internal font with:
  87.  
  88. ??? INTERNAL(5)
  89.  
  90. Or with:
  91.  
  92. ??? landscape + pitch_17
  93.  
  94.      If the page is already set to landscape mode, you don't even
  95. need the landscape variable.  I find the latter more readable and
  96. easier to customize.  For example, I sometimes use the other symbol
  97. sets and with the INTERNAL() function on my HP Laserjet IIP I would
  98. need to expand the options to include 35 different combinations,
  99. not just the six included here.
  100.  
  101.      The one disadvantage of this approach is that it is possible
  102. to combine the printer variables in combinations that do not work
  103. or provide the expected results.  The printer will usually ignore
  104. these combinations and maintain the last default.  This boils down
  105. to one of personal preference (and availability of memory variable
  106. space!).  That is why both are included here.
  107.  
  108.      Another change was replacing the POSITION procedure with my
  109. SAYIT() function.  I added a PICTURE parameter for numbers and
  110. built in type checking so you can pass numbers, dates and logical
  111. values without converting the to character.  The function does the
  112. dirty work for you.
  113.  
  114.      The last major change was the addition of a font loader
  115. function.  This simply copies a font file (such as those made by
  116. Bitsream Fontware) with appropriate commands.  I tried copying the
  117. fonts directly from memo fields, but that didn't seem to work
  118. unless I first copied the memo field to a long string variable.  If
  119. I set MVARSIZE = 64 in my CONFIG.FP file I can print memo field
  120. stored font files up to 64K in size (around 30 points, depending on
  121. the typeface).  Unfortunately this eats up memory, so I'd rather
  122. keep the fonts on the disk. 
  123.  
  124.      By the way, all you Deskjet owners out there, the font
  125. management routines here will work just fine for you as well.  The
  126. box, line, grid and shading routines will not work (but will not
  127. crash the printer, it just ignores them).  I own a Deskjet as well
  128. so I can testify to that!
  129.  
  130.      There are three sample .PRG files.  The first, REPORT1A.PRG is
  131. a modified version of the one provided with the original
  132. LASERLIB.PRG library to show the differences.  The remaining 2,
  133. INVOICE1.PRG and INVOICE2.PRG provide a sample invoice printed with
  134. soft fonts and internal fonts repectively. 
  135.  
  136.      If you get the disk subscription as well, the soft fonts on
  137. the disk are courtesy of:
  138.  
  139.           Swifte International, Ltd.
  140.           Stone Mill Office park
  141.           724 Yorklyn Rd.
  142.           Hockessin, DE 19707
  143.           (800) 237-9383
  144.  
  145. Swifte provides a good font management and font creation system for
  146. those on a budget.  Demos are available on BBSs everywhere, and
  147. they offer a 30 day money back guarantee.  
  148.  
  149.  
  150.                          Richard Elliott
  151.                          Ferret Software
  152.                          1102 Burwick Drive
  153.                          Herndon, VA 22070
  154.  
  155.                          (703) 742-8266
  156.